<?php

namespace app\common\validate;
use think\Validate;

class Admin extends Validate{
 
	protected $rule=[

		'username|用户名'=>'require',
		'password|密码'=>'require',
		'conpass|确认密码'=>'require|confirm:password',
		'nickname|昵称'=>'require',
		'email|邮箱'=>'require|email|unique:admin',
		'code|验证码'=>'require',
		'newpassword|新密码'=>'require',
		'newconpass|重复新密码'=>'require|confirm:newpassword',
		'status|状态'=>'require',
		'is_super|管理等级'=>'require'
	];

	//登录验证场景
	public function sceneLogin(){

		return $this->only(['username','password']);
	}
	//注册场景
	public function sceneRegister(){
		return $this->only(['username','password','conpass','nickname','email'])
		->append('username','unique:admin');
	}
	//重置密码验证码
	public function sceneReset(){
		return $this->only(['code','newpassword','newconpass']);
	}
	//修改管理员
	public function sceneEdit(){
		return $this->only(['status','is_super','nickname','email']);
	}

}


